<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/25
 * Time: 10:08
 */

echo 'Math函数';
echo '<br />';

$Num1 = -10;
echo abs($Num1);
echo '<br />';

$Num2 = 5.8;
echo ceil($Num2);
echo '<br />';

$Num3 = 5.8;
echo floor($Num3);
echo '<br />';

$Num4 = 4.8;
$Num5 = 4.4;
echo round($Num4);
echo '<br />';
echo round($Num5);
echo '<br />';

echo max(1,2,3,4,5,6,7,8,9,10);
echo '<br />';

echo min(1,2,3,4,5,6,7,8,9,10);
echo '<br />';

echo rand(10,20);
echo '<br />';
echo '<hr />';

echo 'Date/Time函数';
echo '<br />';

echo time();
echo '<br />';

echo date('Y年m月d日 H:i:s',time());
echo '<br />';

echo strtotime('2021-11-25 09:00:00');
echo '<br />';

//初始化时间找到0点
$NowTime = time();
$NowTime-$NowTime%(3600*26)-8*3600;
echo date('Y年m月d日 H:i:s',$NowTime-$NowTime%(3600*24)-8*3600);
echo '<br />';
echo '<hr />';

echo '杂项函数';
echo '<br />';

define('APP_PATH','D:\phpstudy_pro\WWW\112501');
echo APP_PATH;
echo '<br />';

if(!defined('APP_PATH')){
    define('APP_PATH','D:\phpstudy_pro\WWW\112501');
}else{
    echo '已存在';
}
echo '<br />';

echo '开始程序!';
echo '<br />';
echo '退出程序!';
echo '<br />';
//相同代码
echo '开始程序!';
echo '<br />';
//添加die函数退出程序
sleep(2);
//die();
//exit('退出程序');
echo '退出程序!';
echo '<br />';

$words = "echo 'abc';";
eval($words);
echo '<br />';
echo '<hr />';

//print_r($GLOBALS);
//echo '<br />';


echo '请求路径:'.$_SERVER['REQUEST_URI'];
echo '<br />';
echo '请求方法:'.$_SERVER['REQUEST_METHOD'];
echo '<br />';
echo '用户IP地址:'.$_SERVER['REMOTE_ADDR'];
echo '<br />';
